package com.gitee.chili.leisure.config;

import feign.Contract;
import org.springframework.cloud.openfeign.support.SpringMvcContract;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 不需要配置 {@code URI} 形式的请求，必须使用当前配置，并且方法名不要随意更改
 *
 * 使用{@code RPC}调用正确的方式:
 * {@link org.springframework.cloud.openfeign.FeignClient}
 * 配置 {@link org.springframework.cloud.openfeign.FeignClient#configuration} 为当前配置类
 * <code>
 *     FeignClient(name = "startGamingFeign", configuration = FeignSpringConfiguration.class)
 *     public interface StartGamingFeign {
 *
 *     }
 * </code>
 *
 * 可能出现的异常：
 *  - Class 'xxx' has annotations [FeignClient] that are not used by contract Default
 *  - Method 'xxx' has an annotation PostMapping that is not used by contract Default
 *
 * @author week solider
 * @version v1.0
 * @since 01.09.2020
 */

@Configuration
public class FeignSpringConfiguration extends FeignConfiguration {

    @Bean
    public Contract feignSpringContract() {
        return new SpringMvcContract();
    }
}
